<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="common/head :: head"></head>
<script type="text/javascript">
    $(function(){
        $('#ec').validate({
            rules:{
                name:"required",
                username:{
                    rangelength:[3,15]
                },
                phone:{
                    required:true,
                    rangelength:[11,11]
                },
                password:{
                    required:true,
                    rangelength:[6,15]
                },
                confirmPassword:{
                    equalTo:"#password"
                }
            },
            messages:{
                name:"真实姓名必须输入",
                username:{
                    rangelength:"用户账号3到15位"
                },
                phone:{
                    required: "手机号码必须输入",
                    rangelength:"手机号码格式不正确"
                },
                password:{
                    required: "密码必须输入",
                    rangelength:"密码6到15位"
                },
                confirmPassword:{
                    equalTo:"密码与确认密码不一致"
                }
            },
            submitHandler: function(form) {
                $(form).find(":submit").attr("disabled", true).text("正在提交...");
                form.submit();
            }
        });
    });
</script>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-content" style="width: 98%;">
            <form id="ec" th:action="@{/admin/save}" method="post" class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-2 control-label">真实姓名：</label>
                    <div class="col-sm-10">
                        <input type="text" name="name" id="name" class="form-control" />
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">用户账号：</label>
                    <div class="col-sm-10">
                        <input type="text" name="username" id="username" class="form-control"/>
                        <label for="username" class="error" id="usernameLabel"></label>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">手机号码：</label>
                    <div class="col-sm-10">
                        <input type="text" name="phone" id="phone" maxlength="11" class="form-control"/>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">密码：</label>
                    <div class="col-sm-10">
                        <input type="password" name="password" id="password" maxlength="15" class="form-control"/>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">确认密码：</label>
                    <div class="col-sm-10">
                        <input type="password" name="confirmPassword" id="confirmPassword" maxlength="15" class="form-control"/>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2 text-right">
                        <button class="btn btn-primary" type="submit">确定</button>
                        <button class="btn btn-white" type="button" onclick="javascript:opt.closeWin();" value="取消">取消</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>